<script setup lang="ts">
import { ContentWrap } from '@/components/ContentWrap'
import { useI18n } from '@/hooks/web/useI18n'
import { Table } from '@/components/Table'
import { getTableListApi } from '@/api/table'
import {shouCangDeKeCheng, TableData} from '@/api/table/types'
import {ref, h, reactive} from 'vue'
import { TableColumn, TableSlotDefault } from '@/types/table'
import {lineOptions } from './echarts-data'

import {set} from "lodash-es";
import {EChartsOption} from "echarts";
import oo from "./ShouCangDeKeChengTongJiTu.vue";




interface Params {
  pageIndex?: number
  pageSize?: number
}

const { t } = useI18n()
let tableDataList = ref<shouCangDeKeCheng[]>([])

const getTableList = async () => {
  const res = await getTableListApi()
      .catch(() => {})
      .finally(() => {
        loading.value = false
      })
  if (res) {
    tableDataList.value = res.data
    console.log(tableDataList.value)
  }
}

getTableList()
const columns: TableColumn[] = [

  {
    field: 'courseClassName',
    label: '课程类型'
  },
 {
    field: 'LookNum',
    label: "收藏次数"
  },
]

const loading = ref(true)


const actionFn = (data: TableSlotDefault) => {
  console.log(data)
}


</script>

<template>

      <ContentWrap :title="t('tongJi.title1')" >
        <Table
            :columns="columns"
            :data="tableDataList"
            :loading="loading"
            :defaultSort="{ prop: 'display_time', order: 'descending' }"
        >
          <template #action="data">
            <ElButton type="primary" @click="actionFn(data as TableSlotDefault)">
              {{ t('tableDemo.action') }}
            </ElButton>
          </template>
        </Table>
      </ContentWrap>
  <oo/>

</template>
